package cn.itcast.erp.exception;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 全局异常处理
 * @author 周昌洋
 * @date 2019/6/15
 */
@Component
public class GlobalExceptionResolver implements HandlerExceptionResolver {

    @Override
    public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {


        ModelAndView mv = new ModelAndView();

//        输入格式错误异常
        if (ex instanceof DataErrorException){

        }
//        输入为空异常
        if (ex instanceof InputNullException){


        }

        return mv;
    }
}
